3.45 \(\int \frac{1}{(1+\cos ^2(x))^2} \, dx\)

Optimal. Leaf size=55 \[ \frac{3 x}{4 \sqrt{2}}-\frac{\sin (x) \cos (x)}{4 \left (\cos ^2(x)+1\right )}-\frac{3 \tan ^{-1}\left (\frac{\sin (x) \cos (x)}{\cos ^2(x)+\sqrt{2}+1}\right )}{4 \sqrt{2}} \]

[Out]

(3*x)/(4*Sqrt[2]) - (3*ArcTan[(Cos[x]*Sin[x])/(1 + Sqrt[2] + Cos[x]^2)])/(4*Sqrt[2]) - (Cos[x]*Sin[x])/(4*(1 +
 Cos[x]^2))

________________________________________________________________________________________

Rubi [A]  time = 0.0257585, antiderivative size = 55, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 8, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.5, Rules used = {3184, 12, 3181, 203} \[ \frac{3 x}{4 \sqrt{2}}-\frac{\sin (x) \cos (x)}{4 \left (\cos ^2(x)+1\right )}-\frac{3 \tan ^{-1}\left (\frac{\sin (x) \cos (x)}{\cos ^2(x)+\sqrt{2}+1}\right )}{4 \sqrt{2}} \]

Antiderivative was successfully verified.

[In]

Int[(1 + Cos[x]^2)^(-2),x]

[Out]

(3*x)/(4*Sqrt[2]) - (3*ArcTan[(Cos[x]*Sin[x])/(1 + Sqrt[2] + Cos[x]^2)])/(4*Sqrt[2]) - (Cos[x]*Sin[x])/(4*(1 +
 Cos[x]^2))

Rule 3184

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_), x_Symbol] :> -Simp[(b*Cos[e + f*x]*Sin[e + f*x]*(a + b*Sin[
e + f*x]^2)^(p + 1))/(2*a*f*(p + 1)*(a + b)), x] + Dist[1/(2*a*(p + 1)*(a + b)), Int[(a + b*Sin[e + f*x]^2)^(p
 + 1)*Simp[2*a*(p + 1) + b*(2*p + 3) - 2*b*(p + 2)*Sin[e + f*x]^2, x], x], x] /; FreeQ[{a, b, e, f}, x] && NeQ
[a + b, 0] && LtQ[p, -1]

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 3181

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(-1), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist
[ff/f, Subst[Int[1/(a + (a + b)*ff^2*x^2), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x]

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rubi steps

\begin{align*} \int \frac{1}{\left (1+\cos ^2(x)\right )^2} \, dx &=-\frac{\cos (x) \sin (x)}{4 \left (1+\cos ^2(x)\right )}-\frac{1}{4} \int -\frac{3}{1+\cos ^2(x)} \, dx\\ &=-\frac{\cos (x) \sin (x)}{4 \left (1+\cos ^2(x)\right )}+\frac{3}{4} \int \frac{1}{1+\cos ^2(x)} \, dx\\ &=-\frac{\cos (x) \sin (x)}{4 \left (1+\cos ^2(x)\right )}-\frac{3}{4} \operatorname{Subst}\left (\int \frac{1}{1+2 x^2} \, dx,x,\cot (x)\right )\\ &=\frac{3 x}{4 \sqrt{2}}-\frac{3 \tan ^{-1}\left (\frac{\cos (x) \sin (x)}{1+\sqrt{2}+\cos ^2(x)}\right )}{4 \sqrt{2}}-\frac{\cos (x) \sin (x)}{4 \left (1+\cos ^2(x)\right )}\\ \end{align*}

Mathematica [A]  time = 0.0757308, size = 35, normalized size = 0.64 \[ \frac{3 \tan ^{-1}\left (\frac{\tan (x)}{\sqrt{2}}\right )}{4 \sqrt{2}}-\frac{\sin (2 x)}{4 (\cos (2 x)+3)} \]

Antiderivative was successfully verified.

[In]

Integrate[(1 + Cos[x]^2)^(-2),x]

[Out]

(3*ArcTan[Tan[x]/Sqrt[2]])/(4*Sqrt[2]) - Sin[2*x]/(4*(3 + Cos[2*x]))

________________________________________________________________________________________

Maple [A]  time = 0.017, size = 27, normalized size = 0.5 \begin{align*} -{\frac{\tan \left ( x \right ) }{4\, \left ( \tan \left ( x \right ) \right ) ^{2}+8}}+{\frac{3\,\sqrt{2}}{8}\arctan \left ({\frac{\tan \left ( x \right ) \sqrt{2}}{2}} \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(1+cos(x)^2)^2,x)

[Out]

-1/4*tan(x)/(tan(x)^2+2)+3/8*arctan(1/2*tan(x)*2^(1/2))*2^(1/2)

________________________________________________________________________________________

Maxima [A]  time = 1.49173, size = 35, normalized size = 0.64 \begin{align*} \frac{3}{8} \, \sqrt{2} \arctan \left (\frac{1}{2} \, \sqrt{2} \tan \left (x\right )\right ) - \frac{\tan \left (x\right )}{4 \,{\left (\tan \left (x\right )^{2} + 2\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(1+cos(x)^2)^2,x, algorithm="maxima")

[Out]

3/8*sqrt(2)*arctan(1/2*sqrt(2)*tan(x)) - 1/4*tan(x)/(tan(x)^2 + 2)

________________________________________________________________________________________

Fricas [A]  time = 1.66115, size = 178, normalized size = 3.24 \begin{align*} -\frac{3 \,{\left (\sqrt{2} \cos \left (x\right )^{2} + \sqrt{2}\right )} \arctan \left (\frac{3 \, \sqrt{2} \cos \left (x\right )^{2} - \sqrt{2}}{4 \, \cos \left (x\right ) \sin \left (x\right )}\right ) + 4 \, \cos \left (x\right ) \sin \left (x\right )}{16 \,{\left (\cos \left (x\right )^{2} + 1\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(1+cos(x)^2)^2,x, algorithm="fricas")

[Out]

-1/16*(3*(sqrt(2)*cos(x)^2 + sqrt(2))*arctan(1/4*(3*sqrt(2)*cos(x)^2 - sqrt(2))/(cos(x)*sin(x))) + 4*cos(x)*si
n(x))/(cos(x)^2 + 1)

________________________________________________________________________________________

Sympy [B]  time = 7.45973, size = 218, normalized size = 3.96 \begin{align*} \frac{3 \sqrt{2} \left (\operatorname{atan}{\left (\sqrt{2} \tan{\left (\frac{x}{2} \right )} - 1 \right )} + \pi \left \lfloor{\frac{\frac{x}{2} - \frac{\pi }{2}}{\pi }}\right \rfloor \right ) \tan ^{4}{\left (\frac{x}{2} \right )}}{8 \tan ^{4}{\left (\frac{x}{2} \right )} + 8} + \frac{3 \sqrt{2} \left (\operatorname{atan}{\left (\sqrt{2} \tan{\left (\frac{x}{2} \right )} - 1 \right )} + \pi \left \lfloor{\frac{\frac{x}{2} - \frac{\pi }{2}}{\pi }}\right \rfloor \right )}{8 \tan ^{4}{\left (\frac{x}{2} \right )} + 8} + \frac{3 \sqrt{2} \left (\operatorname{atan}{\left (\sqrt{2} \tan{\left (\frac{x}{2} \right )} + 1 \right )} + \pi \left \lfloor{\frac{\frac{x}{2} - \frac{\pi }{2}}{\pi }}\right \rfloor \right ) \tan ^{4}{\left (\frac{x}{2} \right )}}{8 \tan ^{4}{\left (\frac{x}{2} \right )} + 8} + \frac{3 \sqrt{2} \left (\operatorname{atan}{\left (\sqrt{2} \tan{\left (\frac{x}{2} \right )} + 1 \right )} + \pi \left \lfloor{\frac{\frac{x}{2} - \frac{\pi }{2}}{\pi }}\right \rfloor \right )}{8 \tan ^{4}{\left (\frac{x}{2} \right )} + 8} + \frac{2 \tan ^{3}{\left (\frac{x}{2} \right )}}{8 \tan ^{4}{\left (\frac{x}{2} \right )} + 8} - \frac{2 \tan{\left (\frac{x}{2} \right )}}{8 \tan ^{4}{\left (\frac{x}{2} \right )} + 8} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(1+cos(x)**2)**2,x)

[Out]

3*sqrt(2)*(atan(sqrt(2)*tan(x/2) - 1) + pi*floor((x/2 - pi/2)/pi))*tan(x/2)**4/(8*tan(x/2)**4 + 8) + 3*sqrt(2)
*(atan(sqrt(2)*tan(x/2) - 1) + pi*floor((x/2 - pi/2)/pi))/(8*tan(x/2)**4 + 8) + 3*sqrt(2)*(atan(sqrt(2)*tan(x/
2) + 1) + pi*floor((x/2 - pi/2)/pi))*tan(x/2)**4/(8*tan(x/2)**4 + 8) + 3*sqrt(2)*(atan(sqrt(2)*tan(x/2) + 1) +
 pi*floor((x/2 - pi/2)/pi))/(8*tan(x/2)**4 + 8) + 2*tan(x/2)**3/(8*tan(x/2)**4 + 8) - 2*tan(x/2)/(8*tan(x/2)**
4 + 8)

________________________________________________________________________________________

Giac [A]  time = 1.19517, size = 80, normalized size = 1.45 \begin{align*} \frac{3}{8} \, \sqrt{2}{\left (x + \arctan \left (-\frac{\sqrt{2} \sin \left (2 \, x\right ) - \sin \left (2 \, x\right )}{\sqrt{2} \cos \left (2 \, x\right ) + \sqrt{2} - \cos \left (2 \, x\right ) + 1}\right )\right )} - \frac{\tan \left (x\right )}{4 \,{\left (\tan \left (x\right )^{2} + 2\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(1+cos(x)^2)^2,x, algorithm="giac")

[Out]

3/8*sqrt(2)*(x + arctan(-(sqrt(2)*sin(2*x) - sin(2*x))/(sqrt(2)*cos(2*x) + sqrt(2) - cos(2*x) + 1))) - 1/4*tan
(x)/(tan(x)^2 + 2)